package com.bf.hotpoint.common.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

public class CharsetInterceptor extends HandlerInterceptorAdapter{

	private String charset;
	
	public String getCharset() {
		return charset;
	}

	public void setCharset(String charset) {
		this.charset = charset;
	}

	@Override
	public boolean preHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler) throws Exception {
		 request.setCharacterEncoding(charset); 
		 response.setContentType("text/html;charset="+charset); 
		return true;
	}
	
}
